@extends('layouts.admin')
@section('content')
						<div id="content-header">
				<h1>用户管理</h1>
				<div class="btn-group">
					<a class="btn btn-large tip-bottom" title="Manage Files"><i class="icon-file"></i></a>
					<a class="btn btn-large tip-bottom" title="Manage Users"><i class="icon-user"></i></a>
					<a class="btn btn-large tip-bottom" title="Manage Comments"><i class="icon-comment"></i><span class="label label-important">5</span></a>
					<a class="btn btn-large tip-bottom" title="Manage Orders"><i class="icon-shopping-cart"></i></a>
				</div>
			</div>
			<div id="breadcrumb">
				<a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>用户列表</a>
				<a href="#" class="current">用户详情</a>
			</div>
			<div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">						
						<div class="widget-box">
							<div class="widget-title">
								<span class="icon">
									<i class="icon-th"></i>
								</span>
								<span class="label label-info"><a href="{{url('admin/rule/create')}}" style="color:white">添加权限</a></span>
							</div>
							<div class="widget-content">
								<table class="table table-bordered table-striped with-check">
									<thead>
										<tr>
											<th>排序</th>
											<th>ID</th>
											<th>权限名称</th>
											<th>权限路由</th>
											<th>描述</th>
											<th>是否为菜单</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
										@foreach($rule as $rules)
										<tr>
											<input type="hidden" name="role_id" value="{{$role_id}}">
											<td style="line-height:50px"><input type="text" value="{{$rules->order}}" style="width:40px;text-align:center;margin-bottom:0px" onchange="changeOrder(this,{{$rules->id}})"></td>
											<td class="tc" style="line-height:50px;text-align:center">{{$rules->id}}</td>
											<td style="line-height:50px;text-align:center">{{str_repeat('-', 4*$rules->count).$rules->display_name}}</td>
											<td style="line-height:50px;text-align:center">
												{{$rules->name}}
											</td>
											<td style="line-height:50px;text-align:center">{{$rules->description}}</td>
											<td style="line-height:50px;text-align:center">{{$rules->is_menu == '0' ? '是' :'否'}}</td>
											<td style="line-height:50px;text-align:center"><button  type="button" class="btn btn-danger"><a href="javascript:" onclick="delArt({{$rules->id}})" style="color:white">删除</a></button> </td>
										</tr>
									@endforeach

									</tbody>
									</form>
								</table>							
							</div>
						</div>
						
					</div>
				</div>
				<div class="row-fluid">
					<div id="footer" class="span12">
						2012 &copy; Unicorn Admin. Brought to you by <a href="https://wrapbootstrap.com/user/diablo9983">diablo9983</a>
					</div>
				</div>
			</div>
			<script type="text/javascript">
                function changeOrder(obj,id){
                    var order = $(obj).val();
                    $.post("{{url('Admin/rule/changeOrder')}}",{'_token':'{{csrf_token()}}','id':id,'order':order},function(data){
                        if(data.status==0){
                            layer.alert(data.msg, {icon: 6});
                        }else{
                            layer.msg(data.msg, {icon: 5});
                        }
                    });
                }
                // 删除友情导航
                function delArt(id){
                    layer.confirm('您确定要删除？', {
                        btn: ['确定','取消'] //按钮
                    }, function(){
                        $.post("{{url('Admin/rule')}}/"+id,{'_method':'delete','_token':'{{csrf_token()}}'},function(data){
                            if(data.status==0){
                                location.href=location.href;
                                layer.msg(data.msg,{icon:6});
                            }else{
                                layer.msg(data.msg,{icon:5});
                            }
                        });
                    }, function(){
                    });
                }
			</script>
@endsection